﻿using System.Collections;
using System.Collections.Generic;
using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class SystemInfoLogic : CommonLogic<SystemInfo, int>, ISystemInfoLogic
    {
        #region Implementation of ICommonLogic<SystemInfo, int>

        /// <sammury>
        /// 创建对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(SystemInfo entity)
        {
            return CreateObject(entity);
        }

        /// <sammury>
        /// 更新对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(SystemInfo entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public int Delete(int entityId)
        {
            return DeleteObject(entityId);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll()
        {
            return DeleteAllObject();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <returns></returns>
        public SystemInfo FindById(int entityId)
        {
            return FindObjectById(entityId);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount()
        {
            return FindObjectByCount();
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<SystemInfo> FindAll()
        {
            return FindAllObject();
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<SystemInfo> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion

        /// <summary>
        /// 根据条件获取系统的权限列表
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public IList<SysPrem> GetSystemPrem(Hashtable ht)
        {
            try
            {
                return FindCustomer<SysPrem>("SystemInfo.FindSystemPrem", ht);
            }
            catch
            {
                throw;
            }
        }

        /// <summary>
        /// 根据类别来获取用户对应的子系统信息
        /// </summary>
        /// <param name="iPremTypeID"></param>
        /// <returns></returns>
        public IList<SystemInfo> GetSystemPremByType(int iPremTypeID)
        {
            try
            {
                return FindCustomer<SystemInfo>("SystemInfo.FindSystemPremByType", iPremTypeID);
            }
            catch
            {
                throw;
            }
        }
    }
}
